package distribution

import (
	"activity_srv/activityclient"
	"api/internal/respons"
	"api/internal/svc"
	"api/internal/types"
	"context"

	"github.com/zeromicro/go-zero/core/logx"
)

type GetUserWithdrawRankLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewGetUserWithdrawRankLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserWithdrawRankLogic {
	return &GetUserWithdrawRankLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

// GetUserWithdrawRank 获取用户提现排名
func (l *GetUserWithdrawRankLogic) GetUserWithdrawRank(req *types.GetUserWithdrawRankRequest) (resp *types.Response, err error) {
	userWithdrawRank, err := l.svcCtx.ActivityRpc.GetUserWithdrawRank(l.ctx, &activityclient.GetUserWithdrawRankRequest{})
	if err != nil {
		return respons.Error(400, "服务端错误", err.Error()), err
	}

	return respons.Success(userWithdrawRank), nil
}
